package exe3;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class MarketTest {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        SuperMarket market = new SuperMarket();
        market.marketname = "合家福马鞍山路店";
        market.address = "马鞍上103号";
        while (true) {
            System.out.println("1：添加新会员；2：查看超市信息；3：给某一用户涨分；4：兑换奖品；5.退出,6:找积分最高的");
            int choose = scanner.nextInt();
            if (choose == 1) {
                Vip vip = new Vip();
                System.out.println("请输入新会员的会员号：");
                vip.cardNo = scanner.next();
                System.out.println("请输入新会员的姓名：");
                vip.name = scanner.next();
                System.out.println("请输入新会员的手机号：");
                vip.phone = scanner.next();
                System.out.println("请输入新会员的积分：");
                vip.score = scanner.nextInt();
                market.add(vip);
            } else if (choose == 2) {
                market.show();
            } else if (choose == 3) {
                System.out.println("请输入会员号：");
                String cardNo = scanner.next();
                System.out.println("请输入需要增加的积分：");
                int getscore = scanner.nextInt();
                boolean a = market.inc(getscore, cardNo);
                if (a) {
                    System.out.println("涨分成功");
                } else {
                    System.out.println("涨分失败");
                }
            } else if (choose == 4) {
                System.out.println("请输入会员号：");
                String cardNo = scanner.next();
                System.out.println("请输入需要兑换的奖品的序号：");
                int a = scanner.nextInt();
                System.out.println("兑换的结果："+market.change(a, cardNo));
            } else if (choose == 5) {
                break;
            }else if (choose == 6) {
                Vip b = market.getBiggestScore();
                if(b==null){
                    System.out.println("没有");
                }else{
                    System.out.println("最高积分会员信息如下：");
                    b.show();
                }
            }
        }
    }
}
